sync-item-file:
    file.managed:
        - name: /var/bh/lib/scripts/item_paidan_api_files/item_paidan_api_files.sh
        - source: salt://prod/item_paidan_api_files/item_paidan_api_files.sh
        - mode: 700
        - user: amos
        - group: amos
        - makedirs: True
        - backup: minion
        - include_enpty: True
run-sh:
    cmd.run:
        - name: |
            ps -ef|grep 'item_paidan_api_files.sh'|grep -v grep|awk -F ' ' '{print $2}'|xargs kill -9
            rm -rf /tmp/.item_paidan_api_files.sh.pid
            nohup bash /var/bh/lib/scripts/item_paidan_api_files/item_paidan_api_files.sh > /var/bh/lib/scripts/item_paidan_api_files/nohup.out 2>&1 &
        - onlyif: ps -ef|grep 'item_paidan_api_files.sh'|grep -v grep|awk -F ' ' '{print $2}'
        - require:
            - file: sync-item-file



